Release 10.1A: OpenEdge Development:
Java Open Clients


Accessing TABLE or TABLE-HANDLE parameters as OUTPUT

For both output TABLE and TABLE-HANDLE parameters and INPUT-OUTPUT TABLE and TABLE-HANDLE parameters (on output), you must obtain the output ProResultSet object from the ResultSetHolder class and call its methods to get the data. As explained previously, com.progress.open4gl.ProResultSet extends the java.sql.ResultSet interface.

In addition to the standard flat model for viewing individual columns presented by ResultSet objects, ProResultSet allows you to view the object using the Progress array model, which presents a temp-table as individual fields that can contain arrays. You can choose whichever model is most natural or convenient. For more information on the Progress field model, see OpenEdge Development: Open Client Introduction and Programming .

Standard methods in the ProResultSet interface

The standard methods include the methods of java.sql.ResultSet, which use the flat column model. The primary methods in this set are described below.

The following method advances the ResultSet cursor to the next row:

Syntax
boolean next() 

The following method closes the ResultSet:

Syntax
void close() 

For output ResultSet objects, the close() method may be called to close the ResultSet before all the rows have been fetched. No other AppServer method can be called until all the rows are fetched or close() is called.

The following method returns the value of the column identified by the 1-based columnNum:

Syntax
Object getObject(int columnNum) 

The data type of the returned object is the default data type of the column. For example, the default data type for a 4GL CHARACTER field is java.lang.String. For more information, see the "Data type mapping for temp-table fields" section.

The following method returns the value of the column identified by the fieldName:

Syntax
Object getObject(String fieldName) 

The data type of the returned object is the default data type of the field. For example, the default data type for a 4GL CHARACTER field is java.lang.String. For more information, see the "Data type mapping for temp-table fields" section.

The following method returns the value of the column identified by the 1-based columnNum:

Syntax
DataType getDataType(int columnNum) 

DataType is the name of the data type, for example, String getString(), Integer getInteger(), and so on.

The following method returns the value of the column identified by the fieldName:

Syntax
DataType getDataType(String fieldName) 

DataType is the name of the data type; for example, String getString(), Integer getInteger(), and so on.

If the specified return DataType is different from the default data type of the column, the Open Client takes one of the following actions:

For example, if the 4GL data type is INTEGER and its value is 10, getString(columnNum) automatically converts the value from Integer to the java.lang.String, “10”. If the application calls getDate(columnNum), an exception is thrown with the message that an Integer value cannot be converted to Date. For information on the supported conversions, see Table C–6.

ProResultSet interface extensions to java.sql.ResultSet

ProResultSet adds the following methods not found in java.sql.ResultSet, where DataType is the name of the data type. These extensions allow your application to access the data in a ResultSet based on the Progress array model (see the "Accessing temp-table array fields" section).

The following method returns the value of the arrayIndex element of the array field identified by fieldNum:

Syntax
Object getObject(int fieldNum, int arrayIndex) 

The data type of the object is the default data type of the arrayIndex. The arrayIndex and fieldNum are 1-based.

The following method returns the value of the arrayIndex element of the array field identified by fieldName:

Syntax
Object getObject(String fieldName, int arrayIndex) 

The data type of the object is the default data type of the array field. The arrayIndex and fieldName are 1-based.

The following method returns the array field identified by fieldNum:

Syntax
DataType getDataType(int fieldNum, int arrayIndex) 

DataType is the name of the data type; for example, String getString(), Integer getInteger(), and so on. The arrayIndex and fieldNum are 1-based.

The following method returns the array field:

Syntax
DataType getDataType(String fieldName, int arrayIndex) 

DataType is the name of the data type; for example, String getString(), Integer getInteger(), and so on. The arrayIndex and fieldName are 1-based.

For example, here is the syntax for methods that return a value for a String and an Integer array element of a temp-table field:

String getString(int fieldNum, int arrayIndex)  
String getString(String fieldName, int arrayIndex) 
Integer getInteger(int fieldNum, int arrayIndex) 
Integer getInteger(String fieldName, int arrayIndex) 

For a complete listing of the methods implemented by the ProResultSet interface, see the documentation in OpenEdge-install-directory/java/doc/.


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095